package com.atguigu.gulimall.member.config;

import com.atguigu.gulimall.member.interceptor.LoginUserInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: fd
 * @Date 2021/10/12 9:10
 * @Description: 登录拦截器配置类，使其拦截所有路径使其拦截生效
 */
@Configuration
public class MemberWebConfig implements WebMvcConfigurer {

	final LoginUserInterceptor loginUserInterceptor;

	public MemberWebConfig(LoginUserInterceptor loginUserInterceptor) {
		this.loginUserInterceptor = loginUserInterceptor;
	}

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(loginUserInterceptor).addPathPatterns("/**");
	}
}
